package pkg

import (
	"encoding/json"
	"fmt"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
)

func NewBaidu(str string) bool {
	client := censor.NewClient("btYupGZsG3pCa0srtcVELPlt", "fzTUONC01UZoVHktSexB4q6qUMaArD5J")
	//如果是百度云ak sk,使用下面的客户端
	//client = censor.NewCloudClient("ak", "sk")
	res := client.TextCensor(str)
	fmt.Println(res)
	var resData map[string]interface{}
	json.Unmarshal([]byte(res), &resData)
	fmt.Println(resData)
	if resData["conclusion"] == "不合规" {
		return false
	}
	return true
}
